#ifndef xd3d9RenderTarget_h_h_h_h
#define	xd3d9RenderTarget_h_h_h_h

#include "setup.h"

namespace XE
{
	class xd3d9RenderTarget :public xRenderTarget
	{
	public:
		xd3d9RenderTarget(const  xString& name,const RenderConfig& Renderconfig,LPDIRECT3DDEVICE9 *pDevice=NULL);
		virtual ~xd3d9RenderTarget();

       

	protected:


		HRESULT Present()
		{

			if(m_pSwapchain9!=NULL)
			   return	 m_pSwapchain9->Present(NULL,NULL,NULL,NULL,0);
             if(m_pDevice!=NULL)
				 return m_pDevice->Present(NULL,NULL,NULL,NULL);
			 return X_FAIL;

		}


		 bool  LostDevice();

		 bool ReSetDevice();

		 void  Resize(UINT width,UINT height);



		LPDIRECT3DDEVICE9 m_pDevice;

		LPDIRECT3DSWAPCHAIN9 m_pSwapchain9;

		bool m_isSwapChain;

	


	};

}

#endif